package com.soats.demo8.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.soats.demo8.entity.Crimes;
import com.soats.demo8.mapper.crimesMapper;
import com.soats.demo8.response.CrimeYearData;
import com.soats.demo8.service.crimesService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class crimesServiceImpl extends ServiceImpl<crimesMapper, Crimes> implements crimesService {

    @Override
    public List<CrimeYearData> getCrimeDataByYear() {
        return getBaseMapper().selectByYear();
    }

    @Override
    public int addCrimeData(Crimes crimes) {
        getBaseMapper().insertAndGetKey(crimes);
        return crimes.getIncidentId();
    }
}
